package com.sznaner.tool.util;

import android.app.Application;
import android.content.Context;
import android.util.Log;

public class NRTool {

    private static final String TAG = "NRTool";

    private Application application;
    private Boolean debugMode;


    private static volatile NRTool mInstance = null;
    private NRTool() {}
    private static NRTool getInstance() {
        if (mInstance == null) {
            synchronized  (NRTool.class){
                if(mInstance == null){
                    mInstance = new NRTool();
                }
            }
        }
        return mInstance;
    }


    public static Context context(){
        Application application = NRTool.getInstance().application;
        if(application == null){
            Log.d(TAG,"请先init()");
        }
        return application.getApplicationContext();
    }

    public static Boolean isDebug(){
        return NRTool.getInstance().debugMode;
    }

    public static NRTool init(Application application){
        NRTool tool = NRTool.getInstance();
        tool.application = application;
        return tool;
    }
    public NRTool debugMode(Boolean debugMode){
        this.debugMode = debugMode;
        return this;
    }




}
